﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Com.Web.coffinegurunaru.AppLogic.Page;
using Com.Framework;
using Com.Framework.Data;
using Com.Library.DB.Advertise;

namespace Com.Web.coffinegurunaru.aboutus
{
	public partial class etc_view : WebPage
	{
		public int PageNo
		{
			get;
			set;
		}

		public AdvertiseEntity AdvertiseInfo
		{
			get;
			set;
		}

		public List<AdvertiseEntity> AdvertiseList
		{
			get;
			set;
		}

		public int AdvertiseNo
		{
			get;
			set;
		}

		public int AdvertiseNo_Prev
		{
			get;
			set;
		}

		public int AdvertiseNo_Next
		{
			get;
			set;
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			this.LeftMenuType = 3;
			int CategoryNo = 4;

			PageNo = Request.QueryString["PageNo"].Parse(1);
			AdvertiseNo = Request.QueryString["AdvertiseNo"].Parse(0);

			if (AdvertiseNo != 0)
			{
				AdvertiseInfo = AdvertiseModel.GetInfo(AdvertiseNo);
			}
			else
			{
				Response.Clear();
				Response.Write("<script language='javascript'>alert('내용이 존재하지 않습니다.'); location.href='/aboutus/ad_etc.aspx';</script>");
				Response.End();
			}
			ListData<AdvertiseEntity, OutputEntity> result = AdvertiseModel.GetList(CategoryNo, 1, 5);
			AdvertiseList = result.Record;

			if (AdvertiseInfo.AdvertiseNo == 0 || AdvertiseInfo.CategoryNo != CategoryNo)
			{
				Response.Clear();
				Response.Write("<script language='javascript'>alert('내용이 존재하지 않습니다.'); location.href='/aboutus/ad_etc.aspx';</script>");
				Response.End();
			}

			int AdvertiseNo_prev, AdvertiseNo_next;
			AdvertiseModel.GetMoveNo(this.AdvertiseNo, out AdvertiseNo_prev, out AdvertiseNo_next);
			AdvertiseNo_Prev = AdvertiseNo_prev;
			AdvertiseNo_Next = AdvertiseNo_next;
		}
	}
}
